﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="vtpsms._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>DANH SÁCH TIN NHẮN ĐÃ LƯU
    </h2>
    <p>
        <asp:GridView runat="server" ID="GrvSms" AutoGenerateColumns="False" AllowPaging="True" PageSize="20" DataKeyNames="SmsId">
            <Columns>
                <asp:TemplateField HeaderText="STT">
                    <ItemTemplate>
                        <%#Container.DataItemIndex + 1 %>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" Width="5%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Nội dung tin nhắn" SortExpression="SmsContent">
                    <ItemTemplate>
                        <asp:Literal ID="ltName" runat="server" Text='<%# (string)Eval("SmsContent") %>' />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="80%" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Ngày tạo" SortExpression="CreateAt">
                    <ItemTemplate>
                        <asp:Literal ID="ltCreateAt" runat="server" Text='<%# string.Format("{0:dd/MM/yyyy hh:mm}", Eval("CreateAt")) %>' />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Right" Width="80px" Wrap="False" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Người tạo" SortExpression="CreateBy">
                    <ItemTemplate>
                        <asp:Literal ID="CreateBy" runat="server" Text='<%# (string)Eval("CreateBy") %>' />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="80px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Trạng thái" SortExpression="Status">
                    <ItemTemplate>
                        <asp:Literal ID="ltStatus" runat="server" Text='<%# (Eval("Status") as short? ?? 0)==1?"Đã gửi":"Chưa gửi" %>' />
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Left" Width="50px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Sửa">
                    <ItemTemplate>
                        <asp:ImageButton ID="imgBtnEdit" CommandArgument='<%# Bind("SmsId")%>' runat="server"
                            CausesValidation="false" CommandName="EditCommand" ImageUrl="~/Images/edit.gif"
                            ToolTip="Sửa" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="5%" />
                    <HeaderStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Xóa">
                    <ItemTemplate>
                        <asp:ImageButton ID="imgBtnDelete" CommandArgument='<%# Bind("SmsId")%>' runat="server"
                            CausesValidation="false" CommandName="DeleteCommand" ImageUrl="~/Images/delete.png"
                            ToolTip="Xóa" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="5%" />
                    <HeaderStyle HorizontalAlign="Center" />
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </p>
    <p style="text-align: right;">
        <asp:Button runat="server" ID="BtnCreateSms" Text="Gửi một tin nhắn mới" OnClick="BtnCreateSms_Click" /></p>
    <p><asp:Panel runat="server" ID="pngDetail" GroupingText="Thêm mới nội dung tin nhắn" Visible="False">
            <table width="100%" cellpadding="2" cellspacing="2">
                <tr>
                    <td colspan="2" style="text-align: center">
                        <asp:Label runat="server" ID="lblErr"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; padding-right: 3px;">Nội dung tin nhắn
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="tbxContent" Width="300px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right; padding-right: 3px;">Danh sách số điện thoại</td>
                    <td>
                        <asp:FileUpload runat="server" ID="fileList" /></td>
                </tr>
                <tr>
                    <td style="text-align: right; padding-right: 3px;"></td>
                    <td>
                        <asp:Button runat="server" ID="btnSaveAndSend" Text="Lưu và gửi tin" OnClick="btnSaveAndSend_Click" />&nbsp;
                        <asp:Button runat="server" ID="btnClose" Text="Đóng lại" OnClick="btnClose_Click" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </p>
</asp:Content>
